/*
 * @Author: your name
 * @Date: 2021-07-28 18:09:27
 * @LastEditTime: 2021-08-11 06:55:25
 * @LastEditors: GGB
 * @Description: In User Settings Edit
 * @FilePath: \flutter_data_center\lib\screens\app\home_page.dart
 */
import 'package:flutter/material.dart';

class HomeScreen extends StatefulWidget {
  @override
  _HomeScreenState createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen>
    with SingleTickerProviderStateMixin {
  PageController _pageController;
  int _current = 0;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    _pageController = new PageController();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
        width: double.infinity,
        height: double.infinity,
        child: PageView(
          controller: _pageController,
          // 不可左右滑动
          physics: NeverScrollableScrollPhysics(),
          children: [
            // //  视频页面
            // HomeItemPage(1),
            // // demo页面
            // HomeItemDemoPage(),
            // // 视频2页面
            // HomeItemPage(2),
            // // 文章列表页面
            // HomeItem3Page(),
            // //  个人中心页面
            // MineMainPage(),
          ],
        ),
      ),
      bottomNavigationBar: BottomNavigationBar(
        type: BottomNavigationBarType.fixed,
        currentIndex: _current,
        selectedItemColor: Colors.redAccent,
        unselectedItemColor: Colors.blueGrey,
        onTap: (value) {
          _pageController.jumpToPage(value);
          setState(() {
            _current = value;
          });
        },
        items: [
          BottomNavigationBarItem(icon: Icon(Icons.home), label: "首页"),
          BottomNavigationBarItem(icon: Icon(Icons.menu), label: "菜单"),
          BottomNavigationBarItem(icon: Icon(Icons.five_g), label: "发现"),
          BottomNavigationBarItem(icon: Icon(Icons.message), label: "消息"),
          BottomNavigationBarItem(icon: Icon(Icons.person), label: "我的"),
        ],
      ),
    );
  }
}
